package com.itheima.controller;

import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author robin
 * @version 1.0
 */
@Controller
public class UserController {
    /**
     * UserController从springmvc容器中找UserServiceImpl没有找到，则从spring容器中找实现类对象。
     */
    @Autowired
    UserService userService;

    @GetMapping("/save")
    public String save(Model model) {
        model.addAttribute("name", "SpringMVC!");
        userService.save();
        System.out.println("UserController.save");
        return "success";
    }


}
